package com.ccbooks.util;

import java.util.List;

import android.content.Context;

import com.ccbooks.dao.BooksDao;
import com.ccbooks.dao.DBHelper;
import com.ccbooks.vo.Book;

public class BookUtil {

	public static int countBooks;
	
	public static int getCount(Context context){
		if(countBooks==0){
			BooksDao dao= BooksDao.getDao(context);
			countBooks=dao.count(DBHelper.TABLE_BOOK);
		}
		return countBooks;
	}
	
	public static int bookSize(List<Book> books) {
		if (books != null) {
			return books.size();
		} else {
			return 0;
		}
	}
}
